package tests;

import common.Utils;
import org.openqa.selenium.By;

public class System_ManagementPage extends Utils {
    public static String url=detailUrl;
    public System_ManagementPage() {
        super(url);
    }
    //检查系统管理页面
    //点击系统管理，然后出现下拉框，然后挨个测试
    public void checkSystemManagement() throws InterruptedException {
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(6) > div")).click();
        driver.get("http://49.235.61.184:8080/system/user");
        //检查姓名、搜索框、查询和重置按钮是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-18 > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter"));
        //系统用户列表是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-18 > div > div:nth-child(2) > div"));

        //角色管理
        driver.get("http://49.235.61.184:8080/system/role");
        //查看角色名称，输入框、重置和查询按钮是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter"));
        //查看校色列表的框架标题是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div > div.ant-pro-table-list-toolbar > div"));
        System.out.println("角色管理测试通过");
        //角色机构哦
        driver.get("http://49.235.61.184:8080/system/dept");
        //角色机构的标题是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-0.ant-col-md-8 > div > div.ant-card-head > div > div.ant-card-head-title"));
        //目录是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-0.ant-col-md-8 > div > div.ant-card-body"));
        //机构管理是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-md-16 > div > div > div > div"));
        System.out.println("机构管理测试通过");
        //岗位设置
        driver.get("http://49.235.61.184:8080/system/position");
        Thread.sleep(2000);
        //岗位设置的名称、搜索框、查询和重置按钮是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(1) > div > div > div.ant-col.ant-form-item-label"));
        driver.findElement(By.cssSelector("#name"));
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(2) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(1) > button"));
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(2) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button"));
        System.out.println("岗位设置测试通过");
        //字典管理
        driver.get("http://49.235.61.184:8080/system/dict");
        //字典管理的名称、搜索框、查询和重置按钮是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter"));
         //字典管理的字典列表是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div"));
        System.out.println("字典管理测试通过");
        //个人设置
        driver.get("http://49.235.61.184:8080/system/setting");
        //个人设置的任务栏是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.leftMenu___179-W"));
        //点击个人设置中的基本设置
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.leftMenu___179-W > ul > li.ant-menu-item.ant-menu-item-selected.ant-menu-item-only-child > span")).click();
        //检查基本设置的头像、更换头像是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.right___3-EXe"));
        //检查姓名提示字是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div:nth-child(2) > div > div.ant-col.ant-form-item-label"));
        //检查姓名输入框是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div:nth-child(2) > div > div.ant-col.ant-form-item-control > div > div > span"));
        //检查电话号提示字是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div:nth-child(3) > div > div.ant-col.ant-form-item-label"));
        //检查电话号输入框是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div:nth-child(3) > div > div.ant-col.ant-form-item-control > div > div > span"));
        //检查邮箱字段是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div:nth-child(4) > div > div.ant-col.ant-form-item-label"));
        //检查邮箱输入框是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div:nth-child(4) > div > div.ant-col.ant-form-item-control > div > div > span"));
        //检查个人简介字段是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div:nth-child(5) > div > div.ant-col.ant-form-item-label"));
        //检查个人简介输入框是否可见
        driver.findElement(By.cssSelector("#profile"));
        //检查提交按钮是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div > div > div.right___2jdGg > div.baseView___3sRG3 > div.left___GavW0 > form > div.ant-space.ant-space-horizontal.ant-space-align-center > div:nth-child(2) > button"));
        System.out.println("个人设置测试通过");
        driver.quit();
    }
}
